import math
def cross(v1,v2):
    res =  [v1[1]*v2[2] - v1[2]*v2[1], v1[2]*v2[0] - v1[0]*v2[2], v1[0]*v2[1] - v1[1]*v2[0]]
    #print res
    result = res[2]
    return result   
 

def dot(s1,s2):
    c = s1[0]*s2[0] + s1[1]*s2[1]
    return c
     

def turn(orientation,source,dest):
    facing=[math.sin(orientation),math.cos(orientation),0]
   # print facing
    diff=[dest[1]-source[1],dest[0]-source[0],0]
    length=math.sqrt(diff[0]*diff[0] + diff[1]*diff[1])
    #length=math.sqrt(length)
    scale= 1/length
    direction=[diff[0]*scale,diff[1]*scale,0]
    result = cross(direction,facing)
    magnitude = abs(result)
    temp=magnitude*10
    temp1=math.floor(temp)
    #print temp1
    #print 'magnitude= '+ str(magnitude)
    if(result<0 and temp1>3):
        trn = "left"
    elif(result>0 and temp1>3):
        trn = "right"
    else:
         prod = dot(direction,facing)
         if(prod<0):
             trn = "uturn"
         else:
             trn = "straight"
    return result,trn

